<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    </head>
    <body>
        <script>
            function changeImage() {
                element = document.getElementById('myimage')
                if (element.src.match("bulbon")) {
                    element.src = "../images/eg_bulboff.gif";
                } else {
                    element.src = "../images/eg_bulbon.gif";
                }
            }
        </script>

        <img id="myimage" onclick="changeImage()" src="../images/eg_bulboff.gif">

        <p>点击灯泡来点亮或熄灭这盏灯</p>

    </body>
</html>
